package genericity_try;

public class MultivariateGenerics<K,V> {
    private K key ;     // 此变量的类型由外部决定
    private V value ;   // 此变量的类型由外部决定
    MultivariateGenerics(K a,V b){
        key=a;
        value=b;
    }
    public MultivariateGenerics() {

    }
    public K getKey(){
        return this.key ;
    }
    public V getValue(){
        return this.value ;
    }
    public void setKey(K key){
        this.key = key ;
    }
    public void setValue(V value){
        this.value = value ;
    }

    public static void main(String[] args) {
        MultivariateGenerics<String,Integer> t = new MultivariateGenerics<>();//菱形语法
        t.setKey("benbendao");
        t.setValue(666);
        System.out.println(t.getKey());
        System.out.println(t.getValue());
    }
}
